package com.example.example.controller;

import com.example.example.service.impl.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("/chat")
public class ChatController {

    @Autowired
    private ChatService chatService;

    /**
     * 流式输出
     * AiService 记忆化聊天
     */
    @PostMapping("/stream")
    public Flux<String> kimiChat(@RequestBody String userMessage) {
        return chatService.kimiChat(userMessage);
    }

}
